import { request } from '@/utils/request';

export const getObj = (query?: any) => {
  return request<{ data: any }>({
    url: `/pm/experimentScheme/` + query.id,
    method: 'GET',
  });
};

export const updateByIdEvery = (data?: Object) => {
  return request<{ data: any }>({
    url: '/pm/experimentScheme/sign',
    method: 'POST',
    data: data,
  });
};

export function putObj(obj?: any) {
  return request({
    url: '/pm/experimentScheme',
    method: 'PUT',
    data: obj,
  });
}

export function queryCraft(taskId?: string) {
  return request({
    url: '/pm/experimentScheme/queryCraft/' + taskId,
    method: 'get',
  });
}

/**
 * 撤回
 * @param obj
 * @returns
 */
export function revokeProcess(obj?) {
  return request({
    url: '/pm/experimentScheme/revoke?comment=' + obj.comment,
    method: 'POST',
    data: obj,
  });
}

/**
 * 同意
 * @param obj
 * @param id
 * @returns
 */
export function complete(obj?: Object, id?: string) {
  return request({
    // url: '/pm/experimentScheme/complete',
    url: '/pm/experimentScheme/complete?id=' + id,
    method: 'POST',
    data: obj,
  });
}

/**
 * 驳回
 * @param obj
 * @returns
 */
export function reject(obj?: Object) {
  return request({
    url: '/pm/experimentScheme/reject',
    method: 'POST',
    data: obj,
  });
}

/**
 * 弃审
 * @param obj
 * @returns
 */
export function abandon(obj?: any) {
  return request({
    url: `/pm/experimentScheme/abandon?comment=${obj.comment}`,
    method: 'post',
    data: obj,
  });
}